/*
客户管理

*/
import httpRequest from '@/utils/httpRequest'
// 模糊匹配客户
export function getSearchlist (params) {
    return httpRequest({
        url: '/basis/sales/company/search',
        method: 'get',
        params: params
    })
}
// 企业收发货地址form表单select框
export function officeSelectData (data) {
  return httpRequest({
    url: '/basis/sales/companyAddress/officeSelectData',
    method: 'get',
    params: data
  })
}
// 根据id获取地址详情
export function getAddressById (data) {
  return httpRequest({
    url: '/basis/sales/companyAddress',
    method: 'get',
    params: data
  })
}
// 产品目录加载接口
export function getTreeData (data) {
  return httpRequest({
    url: '/basis/product/productCategory/treeData',
    method: 'get',
    params: data
  })
}
// 检查往来是否被业务使用
export function isCheck (data) {
  return httpRequest({
    url: '/basis/sales/company/isCheck',
    method: 'get',
    params: data
  })
}
// 检查承运商是否被发运计划使用
export function isCheckPlan (data) {
  return httpRequest({
    url: '/basis/sales/company/isCheckPlan',
    method: 'get',
    params: data
  })
}
// 获取客户详情
export function getById (data) {
  return httpRequest({
    url: '/basis/sales/company/',
    method: 'get',
    params: data
  })
}

// 获取客户列表
export function getList (data) {
  return httpRequest({
    url: '/basis/sales/company/list',
    method: 'get',
    params: data
  })
}

// 客户选择弹窗获取客户列表
export function getWindowList (data) {
  return httpRequest({
    url: '/basis/sales/company/selectWindowList',
    method: 'get',
    params: data
  })
}

// 客户选择弹窗获取客户列表(传sql数据)
export function dynamicWindowList (data) {
  return httpRequest({
    url: '/basis/sales/company/dynamicWindowList',
    method: 'get',
    params: data
  })
}
// 校验重复
export function checkRepeat (data) {
  return httpRequest({
    url: '/basis/sales/company/checkRepeat',
    method: 'post',
    data: data,
    headers: {'Content-Type': 'application/json; charset=utf-8'}
  })
}
// 新增客户或修改客户
export function edit (data) {
  return httpRequest({
    url: '/basis/sales/company',
    method: 'post',
    data: data,
    headers: {'Content-Type': 'application/json; charset=utf-8'}
  })
}
// 根据客户id查询收货地址列表

export function getCompanyArea (data) {
  return httpRequest({
    url: '/basis/sales/companyAddress/list',
    method: 'get',
    params: data
  })
}

// 新增或修改客户收货地址
export function editCompanyArea (data) {
  return httpRequest({
    url: '/basis/sales/companyAddress',
    method: 'post',
    headers: {'Content-Type': 'application/json; charset=utf-8'},
    data: data
  })
}
// 修改客户状态
export function editState (data) {
  return httpRequest({
    url: '/basis/sales/company/updateStatus',
    method: 'post',
    data: data,
    headers: {'Content-Type': 'application/json; charset=utf-8'}
  })
}
// 删除收货地址
export function deleteAddress (data) {
  return httpRequest({
    url: '/basis/sales/companyAddress/delete',
    method: 'post',
    data: data,
    headers: {'Content-Type': 'application/json; charset=utf-8'}
  })
}

// 删除客户
export function delCrm (data) {
  return httpRequest({
    url: '/basis/sales/company/delete',
    method: 'post',
    data: data
  })
}

// 客户选择弹窗获取客户列表
export function getAllCompanyList (data) {
  return httpRequest({
    url: '/basis/sales/company/selectWindowList',
    method: 'get',
    params: data
  })
}

// 财务管理选择账户下拉框数据
export function getAccountSelectList (data) {
    return httpRequest({
        url: '/financeCompanyAccount/getSelectData',
        method: 'get',
        params: data
    })
}

/*
 * 根据企业名称联想搜索
 * params={
 * 	pageNo	是	string	分页参数
 * 	pageSize	是	string	分页参数
 * 	token	否	string	token
 * 	dbNameSys	否	string	admin-sys
 * 	fullNames	否	string	企业全称
 * }
 * 
 * */

export function companySearch (data) {
  return httpRequest({
    url: '/basis/sales/company/getCompanyByCenter',
    method: 'get',
    params: data
  })
}
